package com.capgemini.cn.authority.rest.valueobject.data;

import com.capgemini.cn.authority.data.entity.GroupMembers;
import com.capgemini.cn.authority.data.entity.Groups;
import com.capgemini.cn.authority.data.entity.Roles;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.sql.Timestamp;
import java.util.List;

/**
 * Created at 2017/9/18
 *
 * @author Andriy
 */
@ApiModel(value = "用户组值对象")
@JsonSerialize
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@NoArgsConstructor
public class GroupVO extends Groups {

    /**
     * 用于在创建用户组时来存放父级在用户组主键ID值用的属性，在返回给前台时会忽略掉该属性
     */
    @JsonIgnore
    @Getter
    @Setter
    private Long tmpParentId;

    public GroupVO(String groupName) {
        super(groupName);
    }

    public GroupVO(String groupName, Long tmpParentId) {
        super(groupName);
        this.tmpParentId = tmpParentId;
    }

    @JsonIgnore
    @Override
    public List<GroupMembers> getGroupMembers() {
        return super.getGroupMembers();
    }

    @JsonIgnore
    @Override
    public List<Roles> getRoles() {
        return super.getRoles();
    }

    @JsonIgnore
    @Override
    public Groups getParentGroup() {
        return super.getParentGroup();
    }

    @JsonIgnore
    @Override
    public List<Groups> getChildrenGroups() {
        return super.getChildrenGroups();
    }

    @ApiModelProperty(value = "用户组名称")
    @Override
    public String getGroupName() {
        return super.getGroupName();
    }

    @ApiModelProperty(value = "用户组主键值")
    @Override
    public long getId() {
        return super.getId();
    }

    @ApiModelProperty(value = "用户组创建时间")
    @Override
    public Timestamp getCreateTime() {
        return super.getCreateTime();
    }

    @ApiModelProperty(value = "用户组信息最后更新时间")
    @Override
    public Timestamp getUpdateTime() {
        return super.getUpdateTime();
    }

    @ApiModelProperty(value = "当前用户组的父级主键ID值")
    @Override
    public long getRootGroupId() {
        return super.getRootGroupId();
    }


    @ApiModelProperty(value = "业务数据标识，当前主要目的是用于在自动同步分组数据时用以标识对应业务数据的唯一性")
    @Override
    public String getBizIdentity() {
        return super.getBizIdentity();
    }
}
